﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SkupinaSeznam.aspx.cs"
    Inherits="Sio.Mdm.Web.Organizacija.SkupinaSeznam" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Seznam članov skupine </title>

    <script type="text/javascript">
        var TipiObjektovRenderer = function(value) {
            var r = StoreTipiObjektov.getById(value);
            if (Ext.isEmpty(r)) { return ""; }
            return r.data.Naziv;
        };
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <ext:Store ID="StoreTipiObjektov" runat="server">
        <reader>
            <ext:JsonReader IDProperty="TipObjektaId">
                <Fields>
                    <ext:RecordField Name="TipObjektaId" Type="Int" />
                    <ext:RecordField Name="Naziv" Type="String" />
                </Fields>
            </ext:JsonReader>
        </reader>
    </ext:Store>
    <ext:Viewport ID="Viewport1" runat="server" Layout="Fit">
        <content>
            <sio:GridPanel ID="GridSkupinaSeznam" runat="server" StripeRows="true" TrackMouseOver="true"
                Width="700">                
                <Store>
                    <ext:Store ID="StoreSkupinaSeznam" runat="server">
                        <Reader>
                            <ext:JsonReader IDProperty="SkupinaClanID">
                                <Fields>
                                    <ext:RecordField Name="SkupinaClanID" Type="Int" />
                                    <ext:RecordField Name="SkupinaID" Type="Int" />
                                    <ext:RecordField Name="TipObjektaId" Type="Int" />
                                    <ext:RecordField Name="KljucId" Type="Int" />
                                    <ext:RecordField Name="Opis" Type="String" />
                                    <ext:RecordField Name="Globina" Type="Int" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                        <ext:RowNumbererColumn />
                        <ext:Column ColumnID="SkupinaClanID" Hidden="true" Hideable="false" DataIndex="SkupinaClanID">
                        </ext:Column>
                        <ext:Column ColumnID="SkupinaID" Hidden="true" Hideable="false" DataIndex="SkupinaID">
                        </ext:Column>
                        <ext:Column ColumnID="KljucId" Hidden="true" Hideable="false" DataIndex="KljucId">
                        </ext:Column>
                        <ext:Column Header="Tip objekta" DataIndex="TipObjektaId" Width="150">
                            <Renderer Fn="TipiObjektovRenderer" />
                            <Editor>
                                <ext:ComboBox ID="cbTipiObjektov" runat="server" TypeAhead="true" SelectOnFocus="true"
                                    Editable="true" Mode="Local" ForceSelection="true" StoreID="StoreTipiObjektov"
                                    ValueField="TipObjektaId" DisplayField="Naziv" />
                            </Editor>
                        </ext:Column>
                        <ext:Column ColumnID="Opis" Header="Opis" DataIndex="Opis" Width="300">
                        </ext:Column>
                        <ext:Column ColumnID="Globina" Hidden="false" Hideable="false" DataIndex="Globina">
                        </ext:Column>     
                        <ext:CommandColumn Width="35">
                        <Commands>
                            <ext:GridCommand Icon="NoteEdit" CommandName="Podrobnosti"><ToolTip Text="Podrobnosti" /></ext:GridCommand>
                        </Commands>
                         </ext:CommandColumn>                   
                    </Columns>
                </ColumnModel>
                    <Listeners>
	            	  <Command Handler="openTab('../Uporabnik/Akter.aspx', 'Učeči '+record.data.Ime+' '+record.data.Priimek, {idm: record.id }, 'akter'+record.id);" />
		            </Listeners>
                <SelectionModel>
                    <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" />
                </SelectionModel>
                <TopBar>
                    <ext:Toolbar ID="Toolbar1" runat="server">
                        <Items>
                            <sio:Button runat="server" ID="Dodaj" Text="Dodaj" Icon="Add">
                                <Listeners>
                                    <Click Handler="#{DodajClaneSkupine}.show();" />
                                </Listeners>
                            </sio:Button>
                            <sio:Button runat="server" ID="Remove" Text="Odstrani" Icon="Delete">
                                <DirectEvents>
                                    <Click OnEvent="OdstraniClane">
                                        <Confirmation ConfirmRequest="true" Message="Odstranim izbrane zapise?" />
                                        <ExtraParams>
                                            <ext:Parameter Name="selected" Mode="Raw" Value="Ext.encode(#{GridSkupinaSeznam}.getRowsValues({selectedOnly:true}))" />
                                        </ExtraParams>
                                    </Click>
                                </DirectEvents>
                            </sio:Button>
                            <ext:ToolbarSeparator />
                            <sio:Button runat="server" ID="Button1" Text="Podrobnosti skupine" Icon="GroupEdit">
                                <Listeners>
                                	<Click Handler="#{SkupinaPodrobnosti}.show();" />
                                </Listeners>
                            </sio:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
            </sio:GridPanel>
        </content>
    </ext:Viewport>
    <sio:dialog runat="server" id="DodajClaneSkupine" width="800" height="600" url="SkupinaDodajClane.aspx"
        dialogbuttons="SaveClose">
		<Parameters>
			<ext:Parameter Name="skupinaid" Value="Ext.urlDecode(window.location.search.substring(1)).skupinaid" Mode="Raw" />
		</Parameters>
		<Listeners>	
			<ButtonClicked Handler="debugger;" />
			<Close Handler="#{StoreSkupinaSeznam}.reload();" />
			<ClientNotify Handler="debugger;" />
		</Listeners>
	</sio:dialog>
    </form>    
    
    <sio:dialog runat="server" id="SkupinaPodrobnosti" width="800" height="600" url="SkupinaPodrobnosti.aspx"
        dialogbuttons="SaveClose">
		<Parameters>
			<ext:Parameter Name="skupinaid" Value="Ext.urlDecode(window.location.search.substring(1)).skupinaid" Mode="Raw" />
		</Parameters>
		<Listeners>	
			<ButtonClicked Handler="debugger;" />
			<Close Handler="#{StoreSkupinaSeznam}.reload();" />
			<ClientNotify Handler="debugger;" />
		</Listeners>
	</sio:dialog>
    </form>
</body>
</html>
